<template>
    <p>子组件</p>
    <div>{{num}}</div>

    <button @click="hdClick">点击传值</button>
    <button @click="hdClick1">点击传值10</button>
    <button @click="hdClick2">点击传值111</button>

</template>

<script lang='ts' setup>
import { defineProps , defineEmits } from 'vue'
    let props = defineProps({
        num:{
            type:Number,
            dafault:10
        }
    })
    const emit = defineEmits<{
        (event: 'fn'): void
    }>()
    const emit1 = defineEmits<{
        (event: 'fn',val:number): void
    }>()
    const emit2 = defineEmits<{
        (event: 'update:num',n:number): void
    }>()
    const hdClick = () =>{
        emit('fn')
    }
    const hdClick1 = () =>{
        emit1('fn',10)
    }
    let n:number = Number(props.num)
    const hdClick2 = () =>{
        n++
        emit2("update:num",n)
    }


</script>
 
<style lang="less" scoped>
    
</style>